using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Script.Services;
using System.Collections.Generic;
using Blazing.WebFacade;
using Blazing.BusinessObjects.Tagging;

namespace Blazing.UI.Cms.Admin
{
    /// <summary>
    /// Summary description for AjaxFunctions
    /// </summary>
    [ScriptService]
    [WebService(Namespace = "http://www.bedhound.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class AjaxFunctions : System.Web.Services.WebService {
        [WebMethod]
        [ScriptMethod]
        public string[] AutoCompleteTag(string prefixText, int count)
        {
            List<string> list = new List<string>();
            TaggingController controller = new TaggingController();
            foreach (Tag tag in controller.GetTagsLike(prefixText, count))
            {
                list.Add(tag.Name);
            }
            return list.ToArray();
        }

        //[WebMethod]
        //[ScriptMethod]
        //public string[] AutoCompleteBuildings(string prefixText, int count)
        //{
        //    BuildingController controller = new BuildingController();
        //    List<string> list = new List<string>();
        //    foreach (Building bld in controller.GetBuildings(prefixText, count))
        //    {
        //        list.Add(bld.Name);
        //    }
        //    return list.ToArray();
        //}
    }
}
